package com.moyu.article.controller;

import com.moyu.article.domain.Article;
import com.moyu.article.domain.dto.ArticleSaveDTO;
import com.moyu.article.servcie.IArticleService;
import com.moyu.common.core.controller.BaseController;
import com.moyu.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 文章控制层
 *
 * @Author 赵彦博
 * @Date 2025/1/6 9:55
 */
@RestController
@RequestMapping("/article")
@Tag(name = "文章接口")
public class ArticleController extends BaseController {

    @Autowired
    private IArticleService articleService;

    @PostMapping("/create")
    @Operation(summary = "新增帖子", description = "根据提供的信息新增帖子")
    @ApiResponse(responseCode = "1000", description = "操作成功")
    @ApiResponse(responseCode = "2000", description = "服务繁忙请稍后重试")
    public R<Void> create(@RequestBody ArticleSaveDTO articleSaveDTO) {
        return toR(articleService.create(articleSaveDTO));
    }


}
